﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style>/*<![CDATA[*/

table{border: 1px solid gray;}
td{border: 1px dotted gray;}
p{margin: 3px 0 3px 0; padding: 0;}
#ID_Footer{font-size: small; font-style: italic; text-align: right; margin-top: 4em; padding-top: 4px; border-top: 2px solid gray;}

/*]]>*/</style><title>链接JS的方式</title></head><body>
<div><font class="Apple-style-span" face="Consolas"><br></font></div><div><font class="Apple-style-span" face="Consolas"><br></font></div>
<div><span style="line-height: 190%; "><b><font class="Apple-style-span" face="Consolas">1. 调用外部JS文件</font></b></span></div>
<div><font class="Apple-style-span" face="Consolas"><span style="line-height: 140%; ">&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="line-height: 140%; ">&nbsp;</span><span class="Apple-style-span" style="color: rgb(51, 51, 51); line-height: 16px; white-space: pre; ">&lt;script src=<span style="color: rgb(163, 21, 21);">".../*.js"</span>&gt;&lt;/script&gt;</span></font></div><!--StartFragment--><!--EndFragment-->
<div><span style="line-height: 240%; "><font class="Apple-style-span" face="Consolas">&nbsp; &nbsp; &nbsp; &nbsp; <font class="Apple-style-span" color="#666699">// 可放在head中，也可以放在body的任意元素中，在放置位置处产生输出。</font></font></span></div><div><span style="line-height: 240%; "><font class="Apple-style-span" face="Consolas"><br></font></span></div>
<div><span style="font-weight: bold; line-height: 190%; "><font class="Apple-style-span" face="Consolas">2. 直接在html中写入js代码</font></span></div>
<div><div><span class="Apple-style-span" style="line-height: 18px; "><font class="Apple-style-span" face="Consolas"><!--StartFragment--><pre style="color: rgb(51, 51, 51); font-style: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 16.25px; "><br></pre><pre style="color: rgb(51, 51, 51); font-style: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 16.25px; ">       &lt;script type=<span style="color: rgb(163, 21, 21); ">"text/javascript"</span>&gt;        
           <span style="color: rgb(0, 128, 0); ">// 若为JavaScript文件 text/javascript可省</span>
           <span style="color: rgb(0, 128, 0); ">// js codes here</span>
       &lt;/script&gt;</pre><!--EndFragment--></font></span></div></div>
<div><font class="Apple-style-span" face="Consolas"><br></font></div><div><font class="Apple-style-span" face="Consolas"><br></font></div><div><font class="Apple-style-span" face="Consolas"><br></font></div>
<div><font class="Apple-style-span" face="Consolas"><b>3. 使用language属性（</b><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: normal; font-weight: 600; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(102, 102, 102); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); ">在W3C的HTML标准中，已不再推荐使用</strong><b>）</b></font></div><div><!--StartFragment--><font class="Apple-style-span" face="Consolas"><span class="Apple-style-span" style="color: rgb(51, 51, 51); line-height: 16px; white-space: pre; ">       </span><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; ">&lt;script&nbsp;</span><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: italic; font-weight: 600; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(119, 119, 119); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); ">language="Javascript"</strong><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; ">&gt;&lt;/script&gt;</span><!--EndFragment--><br></font></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-style: italic; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; "><font class="Apple-style-span" face="Consolas"><br></font></span></div><div><span style="color: rgb(119, 119, 119); font-family: Arial, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Open Sans&quot;, &quot;Hiragino Sans GB&quot;, Verdana, sans-serif; font-size: 16px; font-style: italic; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;"><br></span></div><script type="text/javascript" language="javascript" src="jquery.js"></script><script type="text/javascript" language="javascript" src="itemlink.js"></script></body></html>